// 基础数据相关接口
/**
 * 请求回调
 * @callback requestCallback
 * @param {object} data 请求回调的数据
 */
export default {
	/**
	 * 获取项目树
	 * @param {object} opt
	 * @param {object} [opt.data] 请求入参
	 * @param {string} [opt.data.brandId] 品牌标识
	 * @param {string} [opt.data.projectAvlstatus] 项目可用状态Y:可用;N:不可用
	 * @param {string} [opt.data.projectShowstatus] 用户端是否显示Y:显示;N:不显示
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryProjectTree(opt = {}) {
		Http.callService({
			url: "bd/project/tree",
            data: opt.data
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 根据用户获取项目树 BD0012
	 * @param {object} opt
	 * @param {object} [opt.data] 请求入参
	 * @param {string} opt.data.menuCode 菜单code
     * @param {string} [opt.data.brandId] 品牌标识
     * @param {string} [opt.data.dataPolicy] 策略值
	 * @param {string} [opt.data.projectAvlstatus] 项目可用状态Y:可用;N:不可用
	 * @param {string} [opt.data.addUnknown] 添加未知项目
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryProjectTreeByUser(opt = {}) {
		Http.callService({
			url: "bd/project/tree/user",
            data: opt.data
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取子级项目组
	 * @param {object} opt
	 * @param {object} [opt.data] 请求入参
	 * @param {string} [opt.data.projectId] 项目标识
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryPtaggroupTree(opt = {}) {
		Http.callService({
			url: "bd/ptaggroup/tree",
			data: opt.data
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取项目下的科目树
	 * @param {object} opt
	 * @param {object} [opt.data] 请求入参
	 * @param {string} [opt.data.projectId] 项目标识
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	querySubjectListByProjectId(opt = {}) {
		Http.callService({
			url: "bd/subject/list/all",
			data: opt.data
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 根据子级项目获取科目树
	 * @param {object} opt
	 * @param {object} [opt.data] 请求入参
	 * @param {string} [opt.data.ptagId] 子项目标识
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	querySubjectListByPtag(opt = {}) {
		Http.callService({
			url: "bd/subject/ptag/list",
			data: opt.data
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 年份周期列表 BD4006
	 * @param {object} opt
	 * @param {object} opt.data 请求入参
	 * @param {string} [opt.data.projectId] 项目标识
	 * @param {string} [opt.data.pypYear] 项目年份周期年份
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryYearPeriodList(opt = {}) {
		Http.callService({
			url: "bd/pyp/listAll",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 项目下年份信息-无权限 BD7325
	 * @param {object} opt
	 * @param {object} opt.data 请求入参
	 * @param {string} [opt.data.projectId] 项目标识
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryProjectYearList(opt = {}) {
		Http.callService({
			url: "bd/projectyear/list/simple",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	}
};
